package cn.wolfcode.mapper;

import cn.wolfcode.domain.Employee;
import cn.wolfcode.qo.EmployeeQueryObject;
import org.apache.ibatis.annotations.Param;

import java.util.List;

public interface EmployeeMapper {
    int deleteByPrimaryKey(Long id);
    int insert(Employee record);
    Employee selectByPrimaryKey(Long id);
    List<Employee> selectAll();
    int updateByPrimaryKey(Employee record);

    int queryForCount(EmployeeQueryObject qo);
    List<Employee> queryForResult(EmployeeQueryObject qo);

    //void saveRoleId(@Param("employee") Employee employee, @Param("ids") Long ids);
    void saveRoleId(@Param("employee") Employee employee, @Param("ids") Long[] ids);

    /**
     * 通过id删除中间表
     * @param id
     */
    void deleteRoleRelation(Long id);

    /**
     * 通过用户名和密码查询员工
     * @param username
     * @param password
     * @return
     */
    Employee selectByUsernameAndPassword(@Param("username") String username, @Param("password") String password);

    /**
     * 通过id更新员工
     * @param employee
     */
    void updateByPrimaryKey2(Employee employee);

    /**
     * 批量删除员工
     * @param ids
     */
    void deleteBatch(Long[] ids);

    /**
     * 通过名字查询员工
     * @param name
     * @return
     */
    Employee selectByName(String name);

    List<Employee> selectByRoleSn(String... sns);

}